
#ifndef _P2D_FORCE_SPHEREEX_H_
#define _P2D_FORCE_SPHEREEX_H_

#include "p2d_force.h"

namespace part2d
{

/**
* @brief provide a continous, linear force to the system
*
* This force can be used for wind, gravity, etc. 
*/
class P2DForceSphereEx : public P2DForce
{
public:
    /**
    * Initialize class
    */
                    P2DForceSphereEx();
    /**
    * Destroy class
    * force it to be instantiated
    */
    virtual         ~P2DForceSphereEx();

    /**
    * Load settings for particle force from LUA Object
    * @param    _LObj     Lua Table to load from
    */
    virtual bool    Load(LuaPlus::LuaObject& _LObj);

    /**
    * Render a visual representation of this force
    */
	virtual bool	RenderDebug(const math::Vec2& GroupCenter);

    /**
    * Update all active particles in this set
    */
    virtual	bool	MoveParticles(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    /**
    * Clone ourselves
    */
	virtual P2DForce*	Clone();

protected:

    bool	        MovePush(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    bool	        MoveBounce(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    bool	        MoveKill(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);

    math::Vec2                  m_Offset;
    float                       m_Magnitude;
    float                       m_MagSqr;       // Magnitude squared precalced
    float                       m_BounceForce;
    ForceAction                 m_Action;
};

};

#endif //_P2D_FORCE_SPHEREEX_H_